<?php
    $count = count($packages);
    $s = 0;
    $values = array();
    foreach ($packages as $pa) {
        if ($pa->id == $store->package_id)
            continue;
        $values[$s++] = unserialize($pa->values);
    }
    ?>
    <h1><span class="ico_createstore"></span><?= lang('label_upgrade_store'); ?></h1>

    <ul class="breadcrumb">
        <li><a href="<?= base_url() ?>"><?= lang('label_home') ?></a></li>
        <li><a href="<?= base_url('store') ?>"><?= lang('label_menu_link_mystore'); ?></a></li>
        <li><?= lang('label_upgrade_store') ?></li>
    </ul>

    
        <div class="page">
<?php if ($packages) { ?>
<form action="<?= current_url() ?>" method="post">
            <table id="table1">
                <thead>
                    <tr>
                        <th><span><?= lang('label_features') ?></span></th>
                        <?php
                        foreach ($packages as $package) {
                            if ($package->id == $store->package_id)
                                continue;
                            ?>
                            <td><span class="<?= $package->css ?>"><?= $package->title ?></span></td>
                        <?php } ?>
                    </tr>
                </thead>

                <tbody>
                    <?php foreach ($pdetails as $pde) { ?>
                        <tr>
                            <td><?= $pde->title ?></td>
                            <?php for ($i = 0; $i < $count; $i++) { ?>
                                <td><?php
                                    $val = $values[$i][$pde->name];
                                    if ($val == 'false')
                                        echo '<span class="ico_false"></span>';
                                    elseif ($val == 'true')
                                        echo '<span class="ico_true"></span>';
                                    else {
                                        if (is_numeric($val)) {
                                            if ($val == 0)
                                                echo '-';
                                            else
                                                echo $val;
                                        }else {
                                            $val = explode('+', $val);
                                            $f = true;
                                            foreach ($val as $va) {
                                                if (lang('label_values_' . trim($va))) {
                                                    if (!$f)
                                                        echo '+';
                                                    echo lang('label_values_' . trim($va));
                                                } else {
                                                    if (!$f)
                                                        echo '+';
                                                    echo $va;
                                                }
                                                $f = false;
                                            }
                                        }
                                    }
                                    ?></td>
                            <?php } ?>
                        </tr>
                    <?php } ?>
                    <tr>
                        <td><?= lang('label_item_price') . '/' . lang('label_rial') ?></td>
                        <?php
                        foreach ($packages as $package) {
                            if ($package->id == $store->package_id)
                                continue;
                            ?>
                            <td><?= $package->price ?></td>
                        <?php } ?>
                    </tr>
                </tbody>

                <tfoot>
                    <tr>
                        <th><?= lang('label_choose_your_offer') ?> &raquo;</th>
                        <?php
                        foreach ($packages as $package) {
                            if ($package->id == $store->package_id)
                                continue;
                            ?>
                            <td><div class="radio"><input value="<?= $package->id ?>" name="package" id="<?= $package->id ?>" type="radio" /><label for="<?= $package->id ?>"></label></div></td>
                        <?php } ?>
                    </tr>
                </tfoot>
            </table>


            <div class="submit">
                <input name="submit" value="<?= lang('label_upgrade_store') ?>" type="submit"  >
            </div>
    </form>
            <br><br><br>
<?php }else { ?>
    <div class="unsaved">
        <img src="<?php echo str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) ?>/<?php echo APPPATH ?>views/<?php echo $this->themes->Cms_themes() ?>/images/unsaved.png" alt="" />
        <br /><?= lang('message_you_have_max_pack') ?>
    </div>
<?php } ?>
        </div>
    
